<html>
<head><meta charset="utf-8"><title>queries.global_ctxt() crashes · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html">queries.global_ctxt() crashes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="226261942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226261942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226261942">(Feb 13 2021 at 19:14)</a>:</h4>
<p>Hi. I am not sure if this problem I am facing is a result of API misuse.</p>
<p>I am following this guide: <a href="https://github.com/rust-lang/rustc-dev-guide/blob/master/src/rustc-driver-getting-diagnostics.md">https://github.com/rust-lang/rustc-dev-guide/blob/master/src/rustc-driver-getting-diagnostics.md</a></p>
<p>My program enters the<code>compiler.enter(|queries| {</code> closure, but crashes when I call <code>queries.global_ctxt()</code> (I am not doing <code>.unwrap()</code>). I tried using <code>queries.global_ctxt().map_err(|err|</code> for printing the error, but it's not even reaching that part.</p>
<p>I don't have a way to easily extract this section of the code at the moment - too many parameters and the setup is complicated in general. I was wondering if you have hints of what could go wrong for that method specifically.</p>
<div class="codehilite"><pre><span></span><code>rustc 1.51.0-nightly (b12290861 2021-01-29)

&gt; rustup component   list | grep installed
cargo-x86_64-unknown-linux-gnu (installed)
clippy-x86_64-unknown-linux-gnu (installed)
llvm-tools-preview-x86_64-unknown-linux-gnu (installed)
rust-docs-x86_64-unknown-linux-gnu (installed)
rust-src (installed)
rust-std-x86_64-unknown-linux-gnu (installed)
rustc-x86_64-unknown-linux-gnu (installed)
rustc-dev-x86_64-unknown-linux-gnu (installed)
rustfmt-x86_64-unknown-linux-gnu (installed)
</code></pre></div>



<a name="226262449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226262449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226262449">(Feb 13 2021 at 19:27)</a>:</h4>
<p>To reinforce the problem above, if I don't call <code>queries.global_ctxt()</code> then the program does not crash. I am still able to do other things inside of the closure.</p>



<a name="226262850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226262850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cjgillot <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226262850">(Feb 13 2021 at 19:36)</a>:</h4>
<p>Do you have a backtrace of the crash?</p>



<a name="226263509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226263509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226263509">(Feb 13 2021 at 19:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="248906">cjgillot</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/queries.2Eglobal_ctxt().20crashes/near/226262850">said</a>:</p>
<blockquote>
<p>Do you have a backtrace of the crash?</p>
</blockquote>
<p>Trying to get it right now. This code is running as a sub-process inside of a server so I don't get the stderr/stdout easily.<br>
I'll post it here if I manage.</p>



<a name="226264742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226264742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226264742">(Feb 13 2021 at 20:19)</a>:</h4>
<p>Nope. I tried setting <code>RUST_BACKTRACE</code>, <code>RUST_LIB_BACKTRACE</code> and everything else I am aware of but had no luck getting the crash output (if it even is there).</p>



<a name="226265194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226265194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226265194">(Feb 13 2021 at 20:29)</a>:</h4>
<p>how does it crash? if it doesn't panic/ICE then you'll have to use LLDB/GDB to obtain a backtrace</p>



<a name="226269170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269170">(Feb 13 2021 at 21:41)</a>:</h4>
<p>Thanks for the <code>lldb</code> tip. I'm not familiar with systems programming tools and its ecosystem, having only ever used Rust, and only a few times for small personal projects.</p>
<p>It was my first time using <code>lldb</code> so I didn't know what to look for, but here's my guess. I attached to the running process, interrupted it and got to this point</p>
<div class="codehilite"><pre><span></span><code>(lldb) thread backtrace
* thread #1, name = &#39;program&#39;, stop reason = signal SIGSTOP
  * frame #0: 0x00007fc77381d9b7 libpthread.so.0`__pthread_clockjoin_ex + 551
    frame #1: 0x00007fc773931c3d libstd-8ca495943bae7405.so`std::sys::unix::thread::Thread::join::h561ef9aaa0a7b236 at thread.rs:177:23
    frame #2: 0x000055a7288a57c9 program`std::thread::JoinInner$LT$T$GT$::join::h8dff95540a161a04 + 73
    frame #3: 0x000055a7288a5902 program`std::thread::JoinHandle$LT$T$GT$::join::h60973e00ba84c829 + 18
    frame #4: 0x000055a72858bcaf program`rustc_interface::util::scoped_thread::h8896c3cc6a978e8a + 383
    frame #5: 0x000055a72858c06c program`rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::h86846b17f597f0f9 + 508
    frame #6: 0x000055a72812a36e program`rustc_interface::interface::run_compiler::hf85adb2f5fc2180e + 1374
</code></pre></div>
<p>I interrupted and continued a few times, but it seems to be stuck in that place. Then I realized that must be the reason why I wasn't seeing the crashes - the program is still running, but it's stuck in that <code>Thread::join</code>.</p>



<a name="226269289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269289">(Feb 13 2021 at 21:43)</a>:</h4>
<p>Should be this: <a href="https://github.com/rust-lang/rust/blob/3c10a880eca60379343a6c6d19dd5bda38ead55d/compiler/rustc_interface/src/util.rs#L128">https://github.com/rust-lang/rust/blob/3c10a880eca60379343a6c6d19dd5bda38ead55d/compiler/rustc_interface/src/util.rs#L128</a></p>



<a name="226269297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269297">(Feb 13 2021 at 21:43)</a>:</h4>
<div class="codehilite"><pre><span></span><code>$ man 7 signal
SIGSTOP   17,19,23    Stop    Stop process
The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
</code></pre></div>
<p>This seems unlikely to be a bug in the compiler itself.</p>



<a name="226269342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269342">(Feb 13 2021 at 21:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/queries.2Eglobal_ctxt().20crashes/near/226269297">said</a>:</p>
<blockquote>
<div class="codehilite"><pre><span></span><code>$ man 7 signal
SIGSTOP   17,19,23    Stop    Stop process
The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
</code></pre></div>
<p>This seems unlikely to be a bug in the compiler itself.</p>
</blockquote>
<p>that's because I interrupted the process manually on LLDB, right?</p>



<a name="226269352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269352">(Feb 13 2021 at 21:44)</a>:</h4>
<p>what do you mean by "crashes when I call queries.global_ctxt()"? What output do you see?</p>



<a name="226269446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269446">(Feb 13 2021 at 21:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/queries.2Eglobal_ctxt().20crashes/near/226269352">said</a>:</p>
<blockquote>
<p>what do you mean by "crashes when I call queries.global_ctxt()"? What output do you see?</p>
</blockquote>
<p>if the findings about <code>Thread::join</code> hanging are on the right track, then it's not crashing; it's instead getting stuck in that place</p>



<a name="226269606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226269606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226269606">(Feb 13 2021 at 21:50)</a>:</h4>
<p>I think the backtrace is for the wrong thread. I don't know how to get it for another in lldb, but in gdb it's <code>thread apply all where</code>.</p>



<a name="226272024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226272024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226272024">(Feb 13 2021 at 22:16)</a>:</h4>
<p><code>gdb</code> tip was very helpful. I'll spend more time investigating until I have a better idea of the problem. Thanks.</p>



<a name="226278176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226278176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226278176">(Feb 14 2021 at 00:58)</a>:</h4>
<p>here's a gdb session</p>
<div class="codehilite"><pre><span></span><code>(gdb) break *0x0000558dcb2c14b0
Breakpoint 2 at 0x558dcb2c14b0

(gdb) info break
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   0x0000558dcb2c14b0 &lt;rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter&gt;

(gdb) continue
Continuing.
[New Thread 0x7fadcdde4640 (LWP 2357962)]
[Switching to Thread 0x7fadcdde4640 (LWP 2357962)]
Thread 18 &quot;rustc&quot; hit Breakpoint 2, 0x0000558dcb2c14b0 in rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter ()

(gdb) frame
#0  0x0000558dcb2c1a38 in rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter ()

(gdb) step
Single stepping until exit from function _ZN15rustc_interface7queries54_$LT$impl$u20$rustc_interface..interface..Compiler$GT$5enter17h002bd85f7bf03d47E,
which has no line number information.
0x00007fadd4dadfcc in _Unwind_Resume (exc=0x7fad74097370) at /build/gcc/src/gcc/libgcc/unwind.inc:235
235 /build/gcc/src/gcc/libgcc/unwind.inc: No such file or directory.

(gdb) backtrace
#0  0x00007fadd4dadfcc in _Unwind_Resume (exc=0x7fad74097370) at /build/gcc/src/gcc/libgcc/unwind.inc:235
#1  0x0000558dcb2c1986 in rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter ()
#2  0x0000558dcb459aaa in program::main_loop::&lt;impl program::global_state::GlobalState&gt;::on_notification::{{closure}}::{{closure}}::{{closure}} ()
#3  0x0000558dcb2c29a0 in rustc_interface::interface::create_compiler_and_run::{{closure}} ()
#4  0x0000558dcb2c0a95 in rustc_span::with_source_map ()
#5  0x0000558dcb2c2638 in rustc_interface::interface::create_compiler_and_run ()
#6  0x0000558dcb2c2114 in rustc_interface::interface::run_compiler::{{closure}} ()
#7  0x0000558dcb526f5f in rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}} ()
#8  0x0000558dcb77e268 in scoped_tls::ScopedKey&lt;T&gt;::set ()
#9  0x0000558dcb2c0c8b in rustc_span::with_session_globals ()
#10 0x0000558dcb526e9b in rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}} ()
#11 0x0000558dcb526b8b in rustc_interface::util::scoped_thread::{{closure}} ()
#12 0x0000558dcb7d55ea in std::sys_common::backtrace::__rust_begin_short_backtrace ()
#13 0x0000558dcb5292aa in std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}} ()
#14 0x0000558dcb83397a in &lt;std::panic::AssertUnwindSafe&lt;F&gt; as core::ops::function::FnOnce&lt;()&gt;&gt;::call_once ()
#15 0x0000558dcb835844 in std::panicking::try::do_call ()
#16 0x0000558dcb8364fd in __rust_try ()
#17 0x0000558dcb83458e in std::panicking::try ()
#18 0x0000558dcb833daa in std::panic::catch_unwind ()
</code></pre></div>
<p>I'm confused by the backtrace. Is it already panicking at this point or trying to "catch" a panic that could happen?</p>



<a name="226278251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226278251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226278251">(Feb 14 2021 at 01:00)</a>:</h4>
<p>note: <code>rustc_interface::queries::&lt;impl rustc_interface::interface::Compiler&gt;::enter</code> is <code>compiler.enter(|queries| {</code> from <a href="https://github.com/rust-lang/rustc-dev-guide/blob/master/src/rustc-driver-getting-diagnostics.md">https://github.com/rust-lang/rustc-dev-guide/blob/master/src/rustc-driver-getting-diagnostics.md</a></p>



<a name="226278588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226278588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226278588">(Feb 14 2021 at 01:08)</a>:</h4>
<p>I am stil confused why you think global_ctxt() crashes</p>



<a name="226278600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226278600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226278600">(Feb 14 2021 at 01:08)</a>:</h4>
<p>it would be helpful if you could post the output from a normal run without gdb</p>



<a name="226279019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226279019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226279019">(Feb 14 2021 at 01:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/queries.2Eglobal_ctxt().20crashes/near/226278600">said</a>:</p>
<blockquote>
<p>it would be helpful if you could post the output from a normal run without gdb</p>
</blockquote>
<p>I'm unable to do that because this program is running as a sub-process inside of a server. This closure specifically is inside of a separate thread from the main one and there's no communication between the two. It's like a "task" thread that executes something and finishes.</p>



<a name="226279036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226279036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226279036">(Feb 14 2021 at 01:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/queries.2Eglobal_ctxt().20crashes/near/226278588">said</a>:</p>
<blockquote>
<p>I am stil confused why you think global_ctxt() crashes</p>
</blockquote>
<p>You're right that I don't know if it crashes. Although I'm sure something goes wrong when I call it.</p>



<a name="226279501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226279501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226279501">(Feb 14 2021 at 01:34)</a>:</h4>
<p>A GDB session going all the way to the point where it starts popping the stacks</p>
<div class="codehilite"><pre><span></span><code>(gdb) bt
#0  0x00007f1b53014c2e in rustc_parse::new_parser_from_file ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
#1  0x00007f1b53014532 in rustc_parse::parse_crate_from_file ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
#2  0x00007f1b527e6037 in rustc_interface::passes::parse ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
#3  0x00007f1b527fc486 in rustc_interface::queries::Queries::parse ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
#4  0x00007f1b527fcc0e in rustc_interface::queries::Queries::crate_name ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
#5  0x00007f1b527fe1b3 in rustc_interface::queries::Queries::global_ctxt ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so

(gdb) step
Single stepping until exit from function _ZN11rustc_parse20new_parser_from_file17h8c1a920d3876777bE,
which has no line number information.
[New Thread 0x7f1b48cd2640 (LWP 2436154)]
[Thread 0x7f1b4a4e7640 (LWP 2411348) exited]
0x00007f1b53014532 in rustc_parse::parse_crate_from_file ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so

(gdb) step
Single stepping until exit from function _ZN11rustc_parse21parse_crate_from_file17h3f231bc28cec6087E,
which has no line number information.
0x00007f1b527e6037 in rustc_interface::passes::parse ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so

(gdb) step
Single stepping until exit from function _ZN15rustc_interface6passes5parse17hc864bcb485ab9aa3E,
which has no line number information.
0x00007f1b527fc486 in rustc_interface::queries::Queries::parse ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so

(gdb) step
Single stepping until exit from function _ZN15rustc_interface7queries7Queries5parse17h04b6f63b2ef4a9a2E,
which has no line number information.
0x00007f1b527fcc0e in rustc_interface::queries::Queries::crate_name ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so

(gdb) step
Single stepping until exit from function _ZN15rustc_interface7queries7Queries10crate_name17h249b66c451e7bd9aE,
which has no line number information.
0x00007f1b527fe1b3 in rustc_interface::queries::Queries::global_ctxt ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
</code></pre></div>
<p>I'm seeing this <code>_Unwind_Resume</code> pop up when I step out of <code>global_ctxt</code>.</p>
<div class="codehilite"><pre><span></span><code>(gdb)
Single stepping until exit from function _ZN15rustc_interface7queries7Queries11global_ctxt17h30ca19b158936419E,
which has no line number information.
0x00007f1b4fa9afcc in _Unwind_Resume (exc=0x7f1b080bead0) at /build/gcc/src/gcc/libgcc/unwind.inc:235
235 /build/gcc/src/gcc/libgcc/unwind.inc: No such file or directory.

(gdb) bt
#0  0x00007f1b4fa9afcc in _Unwind_Resume (exc=0x7f1b080bead0) at /build/gcc/src/gcc/libgcc/unwind.inc:235
#1  0x00007f1b527feacb in rustc_interface::queries::Queries::global_ctxt ()
   from /home/user/.rustup/toolchains/nightly-2021-01-30-x86_64-unknown-linux-gnu/lib/librustc_driver-a7396df6edcbeec7.so
</code></pre></div>
<p>Then I get more unwind-named steps after that</p>
<div class="codehilite"><pre><span></span><code>uw_init_context_1
uw_frame_state_for
_Unwind_IsSignalFrame
_Unwind_Find_registered_FDE
_Unwind_Find_FDE
uw_frame_state_for
uw_init_context_1
_Unwind_Resume

_Unwind_DebugHook
_Unwind_RaiseException
</code></pre></div>



<a name="226279577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226279577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226279577">(Feb 14 2021 at 01:36)</a>:</h4>
<p>If I just call <code>compiler.enter(|queries| {</code> without <code>global_ctxt</code>, I'm able to do whatever I want inside of closure or outside of it after that. So naively, it has something to do with <code>global_ctxt</code>. I'm not doing any <code>unsafe</code> or <code>unwrap</code> anywhere in my code, so it's unclear what could go wrong from my side.</p>
<p>Forgive me if I am being annoying, but I don't see another way to reason about this.</p>



<a name="226279595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226279595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226279595">(Feb 14 2021 at 01:37)</a>:</h4>
<p>I'll try some older nightly releases to see if it behaves the same</p>



<a name="226285522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226285522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226285522">(Feb 14 2021 at 04:39)</a>:</h4>
<p>I'm sorry but I really don't know how to help if you can't describe what behavior is going wrong</p>



<a name="226285535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226285535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226285535">(Feb 14 2021 at 04:39)</a>:</h4>
<p>What do you expect to see that's different from what's actually happening?</p>



<a name="226320721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/queries.global_ctxt%28%29%20crashes/near/226320721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> resolritter <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/queries.2Eglobal_ctxt().20crashes.html#226320721">(Feb 14 2021 at 19:33)</a>:</h4>
<p>I decided I'd stop working on this for now. Thanks for the help.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>